package com.ce.webframework.sec.dao.impl;

import java.util.List;

import org.hibernate.Query;

import com.ce.webframework.sec.dao.ISecRoleDao;
import com.ce.webframework.sec.model.RoleDO;
import com.sitechasia.webx.core.dao.hibernate3.HibernateDomainObjectDao;

public class SecRoleDaoImpl extends HibernateDomainObjectDao<RoleDO> implements ISecRoleDao {

	public RoleDO getRole(String roleCode)
	{
		String hql = "from RoleDO r where r.code = ?";
		Query query = getSession().createQuery(hql);
		query.setParameter(0, roleCode);
		List list = query.list();
		if(list.size() > 0)
		{
			return (RoleDO)list.get(0);
		}
		return null;
	}
}
